<?php

class subscriber_paid_model extends CI_Model 
{
    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }

	// Get Subscriber based on Subscriber ID
	function getSubscriberPaidByID( $subscriber_id )
	{
		$this->db->where('subscriber_id', $subscriber_id);
		$this->db->from('tbl_subscriber_paid');
		$this->db->order_by('expiry_date', 'desc');
		return $this->db->get();
	}
	
	// Get Subscribers based on array of Subscriber IDs
	function getSubscribersPaidByID( $subscriber_id_array )
	{
		$this->db->where('subscriber_id', '0');
	
		foreach ($subscriber_id_array as $subscriber_id)
			$this->db->or_where('subscriber_id', $subscriber_id);
			
		$this->db->from('tbl_subscriber_paid');
		$this->db->order_by('last_name', 'asc');
		return $this->db->get();
	}

	// Add Subscriber Payment
	function addPayment( $data_array )
	{
		$this->db->insert('tbl_subscriber_paid', $data_array); 
	}
}

?>